package com.socket.service;

import com.socket.dao.GpsBatchDao;
import com.socket.dao.GpsRecordDao;
import com.socket.entity.GpsRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by kaddddd on 2017/7/6 0006.
 */
@Component
public class GpsRecordService {

    @Autowired
    private GpsRecordDao gpsRecordDao;

    @Transactional
    public void insertGpsRecord(GpsRecord gpsRecord){
        gpsRecordDao.insert(gpsRecord);
    }

    public int findOnlineFlag(String nm){
        Integer result = gpsRecordDao.findOnlineFlag(nm);
        if(result == null){
            return 0;
        }else if(result >= 1){
            result = 1;
        }else if(result == 0){
            result = 0;
        }
        return result;
    }
}
